package wiki.generic.iotests;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

import wiki.generic.io.MapDataReader;
import wiki.generic.io.PagesMap;
import wiki.generic.io.PagesMapReader;

/**
 * 
 * @author <p><strong>JwTeam</strong></p> 
 *
 */
public class ConcretePagesMapReader implements PagesMapReader{

	private String pathR;
	
	public ConcretePagesMapReader(String pathR) {
		this.pathR=pathR;
	}
	
	
	@Override
	public HashMap<String, PagesMap> getPageMap(HashMap<String, String> courses) {
	
		Set<String> keys=courses.keySet();
		HashMap<String, PagesMap> pmap=new HashMap<String, PagesMap>();
		for (Iterator<String> iterator = keys.iterator(); iterator.hasNext();) {
			String corso = iterator.next();
			String path=courses.get(corso)+"/"+pathR;
			MapDataReader reader=new ConcreteDataMapReader(path);
			HashMap<String, String> map=reader.getMap();
			pmap.put(corso, new PagesMap(map));
		}
		
		
		return pmap;
	}


	@Override
	public String getFile() {
		return pathR;
	}
}
